package edu.hawaii.halealohacli.kmj;

/**
 * Command class returned when user input is invalid. Prints a helpful error message.
 * Then creates an instance of the Help command and uses it to print more information.
 * 
 * @author Micah Takabayashi
 */
public class InvalidCommand implements Command {

  private String[] arguments;
  
  /**
   * Constructor. Takes as input the parts of the user input that were invalid.
   * @param invalidArguments Invalid input parameter.
   */
  public InvalidCommand(String[] invalidArguments) {
    this.arguments = invalidArguments.clone();
  }
  
  /**
   * Prints the user arguments that were invalid and Help information.
   */
  @Override
  public void printResult() {
    
    System.out.print("\nInvalid arguments:");
    for (String args : this.arguments) {
      System.out.print(" " + args);
    }
    
    HelpCommand help = new HelpCommand();
    help.printResult();
  }
}
